// pages/main/main.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    "banner":[
      "https://c-ssl.dtstatic.com/uploads/item/201110/21/20111021192716_Ffuxa.thumb.1000_0.jpg"
    ],
    "dataList":[
      {
        "thumb":"https://www.wowoqq.com/upimg/allimg/140924/1-140924023003.jpg",
        "label":"圣诞限定咖啡",
        "price":"23.0",
        "sales":"12",
      },
      {
        "thumb":"https://img.wowoqq.com/allimg/170221/1-1F221062047.jpg",
        "label":"哥斯达黎加精品咖啡豆-旅行版",
        "price":"35.5",
        "sales":"12",
      },
      {
        "thumb":"https://www.wowoqq.com/upimg/allimg/130618/1-13061Q23318.jpg",
        "label":"随行杯",
        "price":"29.8",
        "sales":"23",
      },
      {
        "thumb":"https://www.wowoqq.com/upimg/allimg/130618/1-13061Q23311.jpg",
        "label":"欢乐杯",
        "price":"29.5",
        "sales":"21",
      },
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if(typeof this.getTabBar === 'function' && this.getTabBar()){
      this.getTabBar().setData({
          selected:0
        })
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  topUp:function(){
    wx.showToast({
      title: '哈哈哈',
    })
  },
  toOrder:function(){
    const url = '/pages/order/order'
    wx.switchTab({
      url
    })
  }
})